package com.gc.common.utils.file;

/**
 * 媒体类型工具类
 * 
 * @author ruoyi
 */
public class MimeTypeUtils
{
    public static final String IMAGE_PNG = "image/png";

    public static final String IMAGE_JPG = "image/jpg";

    public static final String IMAGE_JPEG = "image/jpeg";

    public static final String IMAGE_BMP = "image/bmp";

    public static final String IMAGE_GIF = "image/gif";


    //图片
    public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };

    //在线打开,不需要下载的文件格式
    public static final String[] ONLINE_OPEN_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" ,"pdf"};

    //其他类型
    public static final String[] OTHER_EXTENSION = { "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", "rar",
            "zip", "gz", "bz2", "mp3"};

    public static final String[] FLASH_EXTENSION = { "swf", "flv" };

    public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
            "asf", "rm", "rmvb", "mp4" , "ogg" };

    public static final String[] DEFAULT_ALLOWED_EXTENSION = {
            // 图片
            "bmp", "gif", "jpg", "jpeg", "png",
            // word excel powerpoint
            "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
            // 压缩文件
            "rar", "zip", "gz", "bz2",
            // pdf
            "pdf",
            //mp3
            "mp3",
            //exe
            "exe"
    };

    //exe 程序文件
    public static final String[] EXE_EXTENSION = {"exe"};

    //gif 图片类型
    public static final String[] GIF_EXTENSION = {"gif"};

    //jpg 图片类型
    public static final String[] JPG_EXTENSION = {"jpg"};

    //mp3 音乐类型
    public static final String[] MUSIC_EXTENSION = {"mp3"};

    //文档 类型
    public static final String[] WORD_EXTENSION = { "doc", "docx" };

    //excel 类型
    public static final String[] EXCEL_EXTENSION = {"xls", "xlsx"};

    //PDF 类型
    public static final String[] PDF_EXTENSION = { "pdf"};

    //PNG 类型
    public static final String[] PNG_EXTENSION = { "png"};

    //ppt 类型
    public static final String[] PPT_EXTENSION = {"ppt","pptx"};

    //txt 类型
    public static final String[] TXT_EXTENSION = {"txt"};

    //video 视频类型
    public static final String[] VIDEO_EXTENSION = {"swf", "flv", "wav", "wma", "wmv", "mid", "avi", "mpg",
            "asf", "rm", "rmvb", "mp4" , "ogg"};

    //压缩文件 类型
    public static final String[] ZIP_EXTENSION = {"rar", "zip", "gz", "bz2"};



    public static String getExtension(String prefix)
    {
        switch (prefix)
        {
            case IMAGE_PNG:
                return "png";
            case IMAGE_JPG:
                return "jpg";
            case IMAGE_JPEG:
                return "jpeg";
            case IMAGE_BMP:
                return "bmp";
            case IMAGE_GIF:
                return "gif";
            default:
                return "";
        }
    }
}
